package Controls;

import android.app.Dialog;
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.TextView;
import etc.com.market.R;

public class DialogHelper {

	public static void ShowMessage(final Context context,
			final CharSequence charSequence) {

		final Dialog dialog = new Dialog(context);
		dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
		dialog.setContentView(R.layout.msg_box);
		TextView txt = (TextView) dialog.findViewById(R.id.text);
		txt.setText(charSequence);
		Button btn = (Button) dialog.findViewById(R.id.btnOkie);

		btn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				dialog.dismiss();
				if (charSequence.equals(context
						.getText(R.string.msg_lose_connect))) {
					// Church.CloseApp();
				}

			}
		});
		btn.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				Button button = (Button) v;
				if (event.getAction() == MotionEvent.ACTION_DOWN)
					button.setBackgroundResource(R.drawable.bg_active);
				if (event.getAction() == MotionEvent.ACTION_UP) {
					button.setBackgroundResource(R.drawable.bg_btn);
				}
				return false;
			}
		});

		dialog.show();
	}
}
